package Client.Component;

import javax.swing.*;
import java.awt.*;

public class ColorButton extends JButton {
    private Color color;

    public ColorButton() {

    }

    public ColorButton(Color color) {
        this.color = color;

    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
//        System.out.println("按钮被绘制");
        g.setColor(this.getColor());
        g.fillRect(0, 0, this.getWidth(), this.getHeight());
    }

    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
        this.repaint();
    }
}
